TC supports OOP simply by extending the existing 'struct' user-defined type available in C. The definition of a user-defined struct type is said to be a CLASS definition if function prototype declarations are included as members of the struct. In this case, the members which are variable declarations are said to declare INSTANCE VARIABLES and the "member function" declarations are said to declare the METHODS which apply to these variables. The following defines the Person class, which declares age and weight instance variables, and set() and print() methods:
struct Person:indirect /* in C++ omit ':indirect' */
{
int age;
int weight;
void set(void); /* in C++ use 'virtual void set(void)' */
void print(void); /* in C++ use 'virtual void print(void)' */
};
(A useful convention is to begin all class names with a capital letter.)